package com.ruoyi.tb.lmt.service.impl;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.oss.core.OssClient;
import com.ruoyi.oss.factory.OssFactory;
import com.ruoyi.tb.lmt.domain.ClientFile;
import com.ruoyi.tb.lmt.domain.DrDamperData;
import com.ruoyi.tb.lmt.domain.OilSampleDetection;
import com.ruoyi.tb.lmt.domain.TbLmtrepairWorkdetail;
import com.ruoyi.tb.lmt.domain.bo.*;
import com.ruoyi.tb.lmt.domain.vo.ClientFileVo;
import com.ruoyi.tb.lmt.domain.vo.DrDamperDataVo;
import com.ruoyi.tb.lmt.domain.vo.OilSampleDetectionVo;
import com.ruoyi.tb.lmt.mapper.*;
import com.ruoyi.tb.lmt.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author: jiaxiufeng
 * @description:
 * @create: 2023/12/28 14:34
 **/
@RequiredArgsConstructor
@Service
public class SytDataServiceImpl implements ISytDataService {
    private final ClientFileMapper clientFileMapper;

    private final DrDamperDataMapper drDamperDataMapper;

    private final SytDataMapper sytDataMapper;

    private final TbLmtrepairWorkdetailMapper tbLmtrepairWorkdetailMapper;

    private final OilSampleDetectionMapper oilSampleDetectionMapper;

    private final JdbcOperations jdbcTemplate;

    @Autowired
    private IMcgsInfoService mcgsInfoService;

    @Autowired
    private IMcgsAlarmInfoService mcgsAlarmInfoService;

    @Autowired
    private IMcgsQj1QdjczService iMcgsQj1QdjczService;

    @Autowired
    private IMcgsQk1QkfzService iMcgsQk1QkfzService;

    @Autowired
    private IMcgsZjfzService iMcgsZjfzService;

    @Autowired
    private IMcgsFpf109eZybzService iMcgsFpf109eZybzService;

    @Autowired
    private IMcgsFpf109eJhbzService iMcgsFpf109eJhbzService;

    @Autowired
    private IMcgsFpf109ezService iMcgsFpf109ezService;

    @Autowired
    private IMcgsFpfzService iMcgsFpfzService;

    @Autowired
    private IMcgsXzzService iMcgsXzzService;

    @Autowired
    private IMcgsXzz1Service iMcgsXzz1Service;

    @Autowired
    private IMcgsJjf1zService iMcgsJjf1zService;

    @Autowired
    private IMcgsJjf2zService iMcgsJjf2zService;

    @Autowired
    private IMcgsJjfzService iMcgsJjfzService;

    @Autowired
    private IMcgsZchzService iMcgsZchzService;

    @Autowired
    private IMcgsZdfzService iMcgsZdfzService;

    @Autowired
    private IDrDamperDataService iDrDamperDataService;

    @Override
    public JSONArray readExcel() throws FileNotFoundException {
        JSONArray res = new JSONArray();
        List<ClientFile> clientFiles = clientFileMapper.selectList(new QueryWrapper<ClientFile>().isNull("analysis_json"));
        for (int i = 0; i < clientFiles.size(); i++) {
            ClientFile clientFile = clientFiles.get(i);
            //下载文件
            String outPath = this.getClass().getResource("/").getPath() + clientFile.getOriginalName();
            OssClient storage = OssFactory.instance(clientFile.getService());
            try (InputStream inputStream = storage.getObjectContent(clientFile.getUrl())) {
                OutputStream outputStream = FileUtil.getOutputStream(outPath);
                IoUtil.copy(inputStream, outputStream, IoUtil.DEFAULT_BUFFER_SIZE);
            } catch (Exception e) {
                throw new ServiceException(e.getMessage());
            }
            //解析文件
            JSONObject analysisJson = genAnalysisJson(clientFile, outPath);
            res.add(analysisJson);
        }
        return res;
    }

    @Override
    public JSONObject readExcelById(String id) throws FileNotFoundException {
        ClientFile clientFile = clientFileMapper.selectById(id);
        //下载文件
        String outPath = this.getClass().getResource("/").getPath() + clientFile.getOriginalName();

        OssClient storage = OssFactory.instance(clientFile.getService());
        try (InputStream inputStream = storage.getObjectContent(clientFile.getUrl())) {
            OutputStream outputStream = FileUtil.getOutputStream(outPath);
            IoUtil.copy(inputStream, outputStream, IoUtil.DEFAULT_BUFFER_SIZE);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
        //解析文件
        JSONObject analysisJson = genAnalysisJson(clientFile, outPath);
        return analysisJson;
    }

    @Override
    public List<DrDamperDataVo> readDamperByDrCarNo(String drCarNo) {
        return drDamperDataMapper.selectVoList(new QueryWrapper<DrDamperData>().like("dr_car_no", drCarNo));
    }

    @Override
    public JSONArray execSytJob() throws FileNotFoundException, JsonProcessingException {
        JSONArray resarr = new JSONArray();
        JSONObject res = new JSONObject();

        //1.获取未关闭的检修任务且有实验台数据的
        List<Map<String, Object>> list = sytDataMapper.findWorkList();
        for (Map<String, Object> map : list) {
            LocalDateTime startTime = (LocalDateTime) map.get("repair_start_date");
            LocalDateTime endTime = (LocalDateTime) map.get("repair_end_date");
            if (map.get("is_test_bed").equals("excel")) {
                //获取符合条件的电子摆数据
                List<ClientFileVo> clientFileVos = clientFileMapper.selectVoList(new QueryWrapper<ClientFile>().like("car_no", map.get("lmt_number")).le("test_date", DateUtil.format(endTime, "yyyy-MM-dd")).ge("test_date", DateUtil.format(startTime, "yyyy-MM-dd")).isNotNull("analysis_json"));
                File file = ResourceUtils.getFile("classpath:fengexian.json");

                for (int i = 0; i < clientFileVos.size(); i++) {
                    ClientFileVo clientFileVo = clientFileVos.get(i);
                    JSONObject curRes = JSONUtil.parseObj(clientFileVo.getAnalysisJson());
                    JSONArray curList = curRes.getJSONArray("list");
                    FileReader fileReader = new FileReader(file.getAbsolutePath());
                    JSONObject fengexian = JSONUtil.parseObj(fileReader.readString());
                    //动态修改fengexian
                    String fengexinKey = UUID.randomUUID().toString().substring(0, 9);
                    fengexian.set("name", "#" + (i + 1));
                    fengexian.set("key", fengexinKey);
                    fengexian.set("model", "divider_" + fengexinKey);
                    JSONObject fengexianOptions = fengexian.getJSONObject("options");
                    fengexianOptions.set("remoteFunc", "func_" + fengexinKey);
                    fengexianOptions.set("remoteOption", "option_" + fengexinKey);
                    if (i == 0) {
                        JSONObject tmp = curRes;
                        JSONArray tmpList = tmp.getJSONArray("list");
                        JSONObject tempItem = tmpList.getJSONObject(0);
                        tmpList.put(0, fengexian);
                        tmpList.put(1, tempItem);
                        res = tmp;
                    } else {
                        JSONArray resList = res.getJSONArray("list");
                        resList.put(fengexian);
                        resList.put(curList.get(0));
                    }
                }
            } else if (map.get("is_test_bed").equals("dr_damper_data")) {
                List<DrDamperDataVo> drDamperDataVoList = drDamperDataMapper.selectVoList(new QueryWrapper<DrDamperData>().like("dr_car_no", map.get("lmt_number")).le("dr_test_date", DateUtil.format(endTime, "yyyy-MM-dd")).ge("dr_test_date", DateUtil.format(startTime, "yyyy-MM-dd")));
                //将formconfig补齐
                if (ObjectUtil.isNotNull(map.get("form_config"))) {
                    try {
                        JSONObject formConfig = JSONUtil.parseObj(map.get("form_config"));
                        JSONArray list1 = formConfig.getJSONArray("list");
                        JSONObject listitem = list1.getJSONObject(0);
                        JSONObject options1 = listitem.getJSONObject("options");
                        options1.set("defaultValue", drDamperDataVoList);
                        res = formConfig;
                    } catch (RuntimeException e) {
                        throw e;
                    }
                }
            } else if (map.get("is_test_bed").equals("oil_sample_detection")) {
                //进行数据处理拼接
                //res  = genOilFrom(map);
            } else if (map.get("is_test_bed").equals("mcgs")) {
            } else {
                System.out.println("todo 未支持的类型");
            }
            TbLmtrepairWorkdetail workdetail = new TbLmtrepairWorkdetail();
            workdetail.setFormConfig(JSONUtil.toJsonStr(res));
            workdetail.setPrintConfig(JSONUtil.toJsonStr(res));
            workdetail.setId(Long.valueOf(map.get("word_detail_id").toString()));
            tbLmtrepairWorkdetailMapper.updateById(workdetail);
            resarr.add(res);
        }
        //3.通过时间,车号查询试验台数据
        //4.拼接json
        return resarr;
    }

    private JSONObject genOilFrom(Map<String, Object> map) throws FileNotFoundException, JsonProcessingException {
        JSONObject res = new JSONObject();
        File file = ResourceUtils.getFile("classpath:oilConfig.json");

        List<String> stringList = Arrays.asList("分类", "Fe", "Cr", "Pb", "Cu", "Sn", "Al", "Ni", "Ag", "Si", "B", "Na", "Mg", "Ca", "Ba", "P", "Zn", "Mo", "Ti", "V", "Mn", "Cd", "H", "C");
        //查询当前车号下有几条不同类型的数据
        List<Map<String, Object>> oilTypeList = sytDataMapper.findOilTypeByLmt(map.get("lmt_number").toString(), map.get("repair_start_date").toString(), map.get("repair_end_date").toString());
        for (int l = 0; l < oilTypeList.size(); l++) {
            String oilType = oilTypeList.get(l).get("oil_type").toString();
            String oilData = oilTypeList.get(l).get("oil_data").toString();
            //1.加载基础样式
            FileReader fileReader = new FileReader(file.getAbsolutePath());
            JSONObject oilForm = JSONUtil.parseObj(fileReader.readString());
            //处理外层
            JSONObject oilFormGroup = oilForm.getJSONArray("list").getJSONObject(0);
            String oilFormGroupKey = UUID.randomUUID().toString().substring(0, 9);
            oilFormGroup.set("key", oilFormGroupKey);
            oilFormGroup.set("model", "model_" + oilFormGroupKey);
            oilFormGroup.set("name", "#" + (l + 1));
            JSONObject oilFormGroupOptions = oilFormGroup.getJSONObject("options");
            oilFormGroupOptions.set("remoteFunc", "func_" + oilFormGroupKey);
            oilFormGroupOptions.set("remoteOption", "option_" + oilFormGroupKey);
            //处理第二层
            JSONArray oilFormGroupList = oilFormGroup.getJSONArray("list");

            for (int i = 0; i < oilFormGroupList.size(); i++) {
                JSONObject item = oilFormGroupList.getJSONObject(i);
                String itemKey = UUID.randomUUID().toString().substring(0, 9);
                item.set("key", itemKey);
                item.set("model", "model_" + itemKey);
                JSONObject itemOptions = item.getJSONObject("options");
                itemOptions.set("remoteFunc", "func_" + itemKey);
                itemOptions.set("remoteOption", "option_" + itemKey);
                if (i == 0) {
                    item.set("name", "#" + (l + 1));
                }
                //第2个元素为栅格布局
                if (i == 1) {
                    JSONArray item0Columns = item.getJSONArray("columns");
                    for (int j = 0; j < item0Columns.size(); j++) {
                        JSONObject item0ColumnObj = item0Columns.getJSONObject(j);
                        item0ColumnObj.set("key", UUID.randomUUID().toString().substring(0, 9));
                        JSONObject item0ColumnObjList0 = item0ColumnObj.getJSONArray("list").getJSONObject(0);
                        String item0ColumnObjList0Key = UUID.randomUUID().toString().substring(0, 9);
                        item0ColumnObjList0.set("key", item0ColumnObjList0Key);
                        item0ColumnObjList0.set("model", "model_" + item0ColumnObjList0Key);
                        JSONObject item0ColumnObjList0Options = item0ColumnObjList0.getJSONObject("options");
                        item0ColumnObjList0Options.set("remoteFunc", "func_" + item0ColumnObjList0Key);
                        item0ColumnObjList0Options.set("remoteOption", "option_" + item0ColumnObjList0Key);
                        if (j == 0) {
                            item0ColumnObjList0Options.set("defaultValue", map.get("lmt_number").toString());
                        } else if (j == 1) {
                            item0ColumnObjList0Options.set("defaultValue", oilType);
                        } else {
                            item0ColumnObjList0Options.set("defaultValue", oilData);
                        }
                    }
                }
                //第二个元素为表格
                if (i == 2) {
                    JSONArray headrRow = item.getJSONArray("headerRow");
                    for (int j = 0; j < headrRow.size(); j++) {
                        JSONObject headerRowObj = headrRow.getJSONObject(j);
                        headerRowObj.set("key", UUID.randomUUID().toString().substring(0, 9));
                    }
                    JSONArray rows = item.getJSONArray("rows");

                    JSONObject row0 = new JSONObject();
                    JSONArray row0ObjColumns = new JSONArray();
                    for (int k = 0; k < stringList.size(); k++) {
                        String head = stringList.get(k);
                        File excelColumn = ResourceUtils.getFile("classpath:excelColumn.json");
                        FileReader fileReaderexcelColumn = new FileReader(excelColumn.getAbsolutePath());
                        JSONObject columnJson = JSONUtil.parseObj(fileReaderexcelColumn.readString());
                        String columnJsonList0Key = UUID.randomUUID().toString().substring(0, 9);
                        JSONObject columnJsonList0 = columnJson.getJSONArray("list").getJSONObject(0);
                        columnJsonList0.set("key", columnJsonList0Key);
                        columnJsonList0.set("model", "model_" + columnJsonList0Key);
                        JSONObject columnJsonList0Options = columnJsonList0.getJSONObject("options");
                        columnJsonList0Options.set("remoteFunc", "func_" + columnJsonList0Key);
                        columnJsonList0Options.set("remoteOption", "option_" + columnJsonList0Key);
                        columnJsonList0Options.set("defaultValue", head);
                        row0ObjColumns.add(columnJson);
                    }
                    row0.set("columns", row0ObjColumns);
                    rows.add(row0);

                    //生成展示数据
                    List<JSONObject> rowArr = genRowsArr(map, oilType);
                    //给rows生成数据
                    JSONObject itemAll = new JSONObject();
                    Long num = 0L;
                    for (int j = 0; j < rowArr.size(); j++) {
                        JSONObject rowData = rowArr.get(j);
                        JSONObject row = new JSONObject();
                        JSONArray rowObjColumns = new JSONArray();
                        num = num + 1;
                        for (int k = 0; k < stringList.size(); k++) {
                            String head = stringList.get(k);
                            File excelColumn = ResourceUtils.getFile("classpath:excelColumn.json");
                            FileReader fileReaderexcelColumn = new FileReader(excelColumn.getAbsolutePath());
                            JSONObject columnJson = JSONUtil.parseObj(fileReaderexcelColumn.readString());
                            String columnJsonListKey = UUID.randomUUID().toString().substring(0, 9);
                            JSONObject columnJsonList = columnJson.getJSONArray("list").getJSONObject(0);
                            columnJsonList.set("key", columnJsonListKey);
                            columnJsonList.set("model", "model_" + columnJsonListKey);
                            JSONObject columnJsonList0Options = columnJsonList.getJSONObject("options");
                            columnJsonList0Options.set("remoteFunc", "func_" + columnJsonListKey);
                            columnJsonList0Options.set("remoteOption", "option_" + columnJsonListKey);
                            if (head.equals("分类")) {
                                columnJsonList0Options.set("defaultValue", rowData.get("type"));
                            } else {
                                columnJsonList0Options.set("defaultValue", rowData.get(head));
                            }
                            rowObjColumns.add(columnJson);
                            if (j == 0) {
                                if (k != 0) {
                                    JSONArray arr = new JSONArray();
                                    String headStr = rowData.get(head).toString();
                                    if (head.equals("H") || head.equals("C")) {
                                        if (headStr.contains("K")) {
                                            headStr = rowData.get(head).toString().substring(0, headStr.length() - 1);
                                            headStr = String.valueOf(Long.valueOf(headStr) * 1000);
                                        }
                                    }
                                    arr.add(headStr);
                                    itemAll.set(head, arr);
                                }
                            } else {
                                if (k != 0) {
                                    String headStr = rowData.get(head).toString();
                                    if (head.equals("H") || head.equals("C")) {
                                        if (headStr.contains("K")) {
                                            headStr = rowData.get(head).toString().substring(0, headStr.length() - 1);
                                            headStr = String.valueOf(Long.valueOf(headStr) * 1000);
                                        }
                                    }
                                    JSONArray array = itemAll.getJSONArray(head);
                                    array.add(headStr);
                                    itemAll.set(head, array);
                                }
                            }
                        }
                        row.set("columns", rowObjColumns);
                        rows.add(row);
                    }
                    itemAll.set("num", num);

                    //添加平均行
                    JSONObject avRow = new JSONObject();
                    JSONArray avRowObjColumns = new JSONArray();
                    for (int k = 0; k < stringList.size(); k++) {
                        String head = stringList.get(k);
                        File excelColumn = ResourceUtils.getFile("classpath:excelColumn.json");
                        FileReader fileReaderexcelColumn = new FileReader(excelColumn.getAbsolutePath());
                        JSONObject columnJson = JSONUtil.parseObj(fileReaderexcelColumn.readString());
                        String columnJsonList0Key = UUID.randomUUID().toString().substring(0, 9);
                        JSONObject columnJsonList0 = columnJson.getJSONArray("list").getJSONObject(0);
                        columnJsonList0.set("key", columnJsonList0Key);
                        columnJsonList0.set("model", "model_" + columnJsonList0Key);
                        JSONObject columnJsonList0Options = columnJsonList0.getJSONObject("options");
                        columnJsonList0Options.set("remoteFunc", "func_" + columnJsonList0Key);
                        columnJsonList0Options.set("remoteOption", "option_" + columnJsonList0Key);
                        columnJsonList0Options.set("defaultValue", head);
                        avRowObjColumns.add(columnJson);
                        if (head.equals("分类")) {
                            columnJsonList0Options.set("defaultValue", "Av");
                        } else {
                            //将数组值进行求平均
                            ObjectMapper mapper = new ObjectMapper();
                            List<Double> list = Arrays.asList(mapper.readValue(JSON.toJSONString(itemAll.get(head)), Double[].class));
                            double avg = list.stream().collect(Collectors.averagingDouble(x -> x));
                            if (head.equals("H") || head.equals("C")) {
                                //判断avg是否大于10w，小于10w 保留整数，大于10w
                                if (avg < 100000) {
                                    columnJsonList0Options.set("defaultValue", Math.round(avg));
                                } else {
                                    columnJsonList0Options.set("defaultValue", Math.round(avg / 1000) + "K");
                                }
                            } else {
                                BigDecimal bd = new BigDecimal(Double.toString(avg));
                                bd = bd.setScale(2, RoundingMode.HALF_UP);
                                String formattedNum = bd.toPlainString();
                                columnJsonList0Options.set("defaultValue", formattedNum);
                            }

                        }
                    }
                    avRow.set("columns", avRowObjColumns);
                    rows.add(avRow);
                    File bzColumn = ResourceUtils.getFile("classpath:biaozhun.json");
                    FileReader fileReaderbzColumn = new FileReader(bzColumn.getAbsolutePath());
                    JSONObject bzRowData = JSONUtil.parseObj(fileReaderbzColumn.readString());
                    JSONObject bzRow = new JSONObject();
                    JSONArray bzRowObjColumns = new JSONArray();
                    for (int k = 0; k < stringList.size(); k++) {
                        String head = stringList.get(k);
                        File excelColumn = ResourceUtils.getFile("classpath:excelColumn.json");
                        FileReader fileReaderexcelColumn = new FileReader(excelColumn.getAbsolutePath());
                        JSONObject columnJson = JSONUtil.parseObj(fileReaderexcelColumn.readString());
                        String columnJsonList0Key = UUID.randomUUID().toString().substring(0, 9);
                        JSONObject columnJsonList0 = columnJson.getJSONArray("list").getJSONObject(0);
                        columnJsonList0.set("key", columnJsonList0Key);
                        columnJsonList0.set("model", "model_" + columnJsonList0Key);
                        JSONObject columnJsonList0Options = columnJsonList0.getJSONObject("options");
                        columnJsonList0Options.set("remoteFunc", "func_" + columnJsonList0Key);
                        columnJsonList0Options.set("remoteOption", "option_" + columnJsonList0Key);
                        columnJsonList0Options.set("defaultValue", head);
                        bzRowObjColumns.add(columnJson);
                        if (head.equals("分类")) {
                            columnJsonList0Options.set("defaultValue", bzRowData.getStr("type"));
                        } else {
                            columnJsonList0Options.set("defaultValue", bzRowData.getStr(head));
                        }
                    }
                    bzRow.set("columns", bzRowObjColumns);
                    rows.add(bzRow);
                }
            }
            if (l == 0) {
                res = oilForm;
            } else {
                JSONArray resList = res.getJSONArray("list");
                resList.add(oilForm.getJSONArray("list").getJSONObject(0));
            }
        }
        return res;
    }

    private List<JSONObject> genRowsArr(Map<String, Object> map, String oilType) {
        List<JSONObject> resArr = new ArrayList<>();
        List<OilSampleDetectionVo> list = getOilSampleData(map.get("lmt_number").toString(), map.get("repair_start_date").toString(), map.get("repair_end_date").toString(), oilType);
        for (int i = 0; i < list.size(); i++) {
            OilSampleDetectionVo oilSampleDetectionVo = list.get(i);
            JSONObject row = new JSONObject();
            row.set("type", i + 1);
            row.set("Fe", oilSampleDetectionVo.getOilFe());
            row.set("Cr", oilSampleDetectionVo.getOilCr());
            row.set("Pb", oilSampleDetectionVo.getOilPb());
            row.set("Cu", oilSampleDetectionVo.getOilCu());
            row.set("Sn", oilSampleDetectionVo.getOilSn());
            row.set("Al", oilSampleDetectionVo.getOilAl());
            row.set("Ni", oilSampleDetectionVo.getOilNi());
            row.set("Ag", oilSampleDetectionVo.getOilAg());
            row.set("Si", oilSampleDetectionVo.getOilSi());
            row.set("B", oilSampleDetectionVo.getOilB());
            row.set("Na", oilSampleDetectionVo.getOilNa());
            row.set("Mg", oilSampleDetectionVo.getOilMg());
            row.set("Ca", oilSampleDetectionVo.getOilCa());
            row.set("Ba", oilSampleDetectionVo.getOilBa());
            row.set("P", oilSampleDetectionVo.getOilP());
            row.set("Zn", oilSampleDetectionVo.getOilZn());
            row.set("Mo", oilSampleDetectionVo.getOilMo());
            row.set("Ti", oilSampleDetectionVo.getOilTi());
            row.set("V", oilSampleDetectionVo.getOilV());
            row.set("Mn", oilSampleDetectionVo.getOilMn());
            row.set("Cd", oilSampleDetectionVo.getOilCd());
            row.set("H", oilSampleDetectionVo.getOilH());
            row.set("C", oilSampleDetectionVo.getOilC());
            resArr.add(row);
        }
        return resArr;
    }

    @Override
    public List<OilSampleDetectionVo> getOilSampleData(String oilId, String startDate, String endDate, String oilType) {
        List<OilSampleDetectionVo> list = oilSampleDetectionMapper.selectVoList(new QueryWrapper<OilSampleDetection>().eq("oil_id", oilId).eq("oil_type", oilType));
        //出来之后再根据日期筛选
        for (int i = 0; i < list.size(); i++) {
            OilSampleDetectionVo oilSampleDetectionVo = list.get(i);
            SimpleDateFormat originalFormat = new SimpleDateFormat("MM/dd/yyyy");
            // 创建用于生成目标格式的SimpleDateFormat对象
            SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd");
            try {
                // 解析原始字符串为Date对象
                Date date = originalFormat.parse(oilSampleDetectionVo.getOilData());
                // 将Date对象格式化为目标格式的字符串
                String formattedDateString = targetFormat.format(date);
                oilSampleDetectionVo.setOilData(formattedDateString);
            } catch (ParseException e) {
                throw new RuntimeException(e);
            }
        }
        list = list.stream().filter(e -> DateUtil.parse(e.getOilData()).compareTo(DateUtil.parse(startDate)) > -1 && DateUtil.parse(e.getOilData()).compareTo(DateUtil.parse(endDate)) < 1).collect(Collectors.toList());
        return list;
    }

    private JSONObject genAnalysisJson(ClientFile clientFile, String outPath) throws FileNotFoundException {
        JSONObject analysisJson = new JSONObject();
        //获取form模版
        File file = ResourceUtils.getFile("classpath:excel.json");
        FileReader fileReader = new FileReader(file.getAbsolutePath());
        analysisJson = JSONUtil.parseObj(fileReader.readString());
        //解析文件
        try {
            ExcelReader reader = ExcelUtil.getReader(outPath);
            List<Map<String, Object>> readAll = reader.readAll();

            JSONObject listItem = analysisJson.getJSONArray("list").getJSONObject(0);
            //修改listItem key，model，options remoteFunc,remoteOption
            String itemKey = UUID.randomUUID().toString().substring(0, 9);
            listItem.set("key", itemKey);
            listItem.set("model", "model_" + itemKey);
            JSONObject itemOptions = listItem.getJSONObject("options");
            itemOptions.set("remoteFunc", "func_" + itemKey);
            itemOptions.set("remoteOption", "option_" + itemKey);
            JSONArray headerRow = new JSONArray();
            for (int k = 0; k < 9; k++) {
                File headerRowColumn = ResourceUtils.getFile("classpath:headerRow.json");
                FileReader headerRowColumnFileReader = new FileReader(headerRowColumn.getAbsolutePath());
                JSONObject headerRowfild = JSONUtil.parseObj(headerRowColumnFileReader.readString());
                headerRowfild.set("key", UUID.randomUUID().toString().substring(0, 9));
                headerRow.add(headerRowfild);
            }
            listItem.set("headerRow", headerRow);
            //处理行数据
            JSONArray rows = listItem.getJSONArray("rows");
            for (int j = 0; j < readAll.size(); j++) {
                Map<String, Object> map = readAll.get(j);
                File excelColumn = ResourceUtils.getFile("classpath:excelColumn.json");
                FileReader excelColumnFileReader = new FileReader(excelColumn.getAbsolutePath());
                JSONObject row = new JSONObject();
                JSONArray columns = new JSONArray();
                //一共9列
                for (int i = 0; i < 9; i++) {
                    JSONObject column = JSONUtil.parseObj(excelColumnFileReader.readString());
                    if (ObjectUtil.isNotNull(map.get(String.valueOf(i)))) {
                        JSONObject text = column.getJSONArray("list").getJSONObject(0);
                        String textKey = UUID.randomUUID().toString().substring(0, 9);
                        JSONObject options = text.getJSONObject("options");
                        text.set("key", textKey);
                        text.set("model", "text_" + textKey);
                        options.set("defaultValue", map.get(String.valueOf(i)));
                        if (options.get("defaultValue").toString().contains("产品编号")) {
                            clientFile.setCarNo(map.get(String.valueOf(i + 1)).toString());
                        }
                        if (options.get("defaultValue").toString().contains("测试日期")) {
                            clientFile.setTestDate(DateUtil.parse(map.get(String.valueOf(i + 1)).toString()));
                        }
                        options.set("remoteFunc", "func_" + textKey);
                        options.set("remoteOption", "option_" + textKey);
                    } else {
                        column.set("list", new JSONArray());
                    }
                    column.set("key", UUID.randomUUID().toString().substring(0, 9));
                    columns.add(column);
                }
                row.set("columns", columns);
                rows.add(row);
            }
        } catch (RuntimeException e) {
            System.out.println(e.getMessage() + outPath);
        }
        clientFile.setAnalysisJson(JSONUtil.toJsonStr(analysisJson));
        clientFileMapper.updateById(clientFile);
        return analysisJson;
    }

    @Override
    public TableDataInfo<OilSampleDetectionVo> selectOil(String lmtNumber, String oilType, PageQuery pageQuery) {
        //查询符合条件的内容
        List<OilSampleDetectionVo> result = oilSampleDetectionMapper.selectOil(lmtNumber, oilType);
        //分页
        if (pageQuery.getPageSize() != null && pageQuery.getPageNum() != null) {
            List<OilSampleDetectionVo> page = ListUtil.page(pageQuery.getPageNum() - 1, pageQuery.getPageSize(), result);
            TableDataInfo res = new TableDataInfo<>(page, result.size());
            return res;
        } else {
            return TableDataInfo.build(result);
        }
    }

    @Override
    public TableDataInfo<DrDamperDataVo> selectDamperData(String drDamperNo, String drDamperType, String drCarNo, PageQuery pageQuery) {
        List<DrDamperDataVo> result = drDamperDataMapper.selectDamperData(drDamperNo, drDamperType, drCarNo);
        if (pageQuery.getPageSize() != null && pageQuery.getPageNum() != null) {
            List<DrDamperDataVo> page = ListUtil.page(pageQuery.getPageNum() - 1, pageQuery.getPageSize(), result);
            TableDataInfo res = new TableDataInfo<>(page, result.size());
            return res;
        } else {
            return TableDataInfo.build(result);
        }
    }

    @Override
    public OilSampleDetectionVo selectOilById(Long id) {
        OilSampleDetectionVo vo = oilSampleDetectionMapper.selectVoById(id);
        if (vo != null) {
            if (StringUtils.isNotBlank(vo.getOilType())) {
                setReportStrs();
                if (reports1Strs.contains(vo.getOilType())) {
                    vo.setReports(reports1(vo));
                } else if (reports2Strs.contains(vo.getOilType())) {
                    vo.setReports(reports2(vo));
                } else if (reports3Strs.contains(vo.getOilType())) {
                    vo.setReports(reports3(vo));
                }
            }
        }
        return vo;
    }

    //ZF
    private List<String> reports1Strs = new ArrayList<>();
    //齿轮
    private List<String> reports2Strs = new ArrayList<>();
    //机油
    private List<String> reports3Strs = new ArrayList<>();

    private void setReportStrs() {
        if (reports1Strs.size() == 0) {
            reports1Strs.add("ZF");
            reports1Strs.add("ZFX");
            reports1Strs.add("ZFJ");
            reports1Strs.add("ZF1");
            reports1Strs.add("ZF2");

        }
        if (reports2Strs.size() == 0) {
            reports2Strs.add("1Z");
            reports2Strs.add("2Z");
            reports2Strs.add("3Z");
            reports2Strs.add("FD");
            reports2Strs.add("JS");
            reports2Strs.add("6Z");
            reports2Strs.add("4Z");
            reports2Strs.add("ZDJ");
            reports2Strs.add("ZY1Z");
            reports2Strs.add("KJ1Z");
            reports2Strs.add("KJ3Z");
            reports2Strs.add("LMCL4W");
            reports2Strs.add("ZY7Z");
            reports2Strs.add("KJ4Z");
            reports2Strs.add("ZY6Z");
            reports2Strs.add("ZY2Z");
            reports2Strs.add("KJ2Z");
            reports2Strs.add("LM1WCL");
            reports2Strs.add("DLFD2K");
            reports2Strs.add("LMCL3W");
            reports2Strs.add("MD");
            reports2Strs.add("QZC");
            reports2Strs.add("HZC");
            reports2Strs.add("ZD");
            reports2Strs.add("WJ");
            reports2Strs.add("ZD2");
            reports2Strs.add("ZD1");
            reports2Strs.add("8Z");
            reports2Strs.add("2#FD");
            reports2Strs.add("5Z");
            reports2Strs.add("3C2WBJ");
            reports2Strs.add("2WFD");
            reports2Strs.add("2WMD");
            reports2Strs.add("1WFD");
            reports2Strs.add("1#FD");
            reports2Strs.add("3#2WBJ");
            reports2Strs.add("1WMD");
            reports2Strs.add("QFD");
            reports2Strs.add("HFD");
            reports2Strs.add("YLBS");
            reports2Strs.add("YLBS1");
            reports2Strs.add("BC");
            reports2Strs.add("CL1");
            reports2Strs.add("CL3");
            reports2Strs.add("CL4");
            reports2Strs.add("BJX1");
            reports2Strs.add("FDJ1");
            reports2Strs.add("FDJ2");
            reports2Strs.add("CLY1");
            reports2Strs.add("CLY3");
            reports2Strs.add("CLY2");
            reports2Strs.add("CLY4");
            reports2Strs.add("WJL");
            reports2Strs.add("ZDG");
            reports2Strs.add("Z1");
            reports2Strs.add("Z2");
            reports2Strs.add("Z3");
            reports2Strs.add("Z4");
            reports2Strs.add("Z5");
            reports2Strs.add("Z6");
            reports2Strs.add("QZ");
            reports2Strs.add("HZ");
            reports2Strs.add("1C1BQD");
            reports2Strs.add("1C2BQD");
            reports2Strs.add("1C3BQ");
            reports2Strs.add("1C4BQ");
            reports2Strs.add("1C2CL");
            reports2Strs.add("1C3CL");
            reports2Strs.add("1C4CL");
            reports2Strs.add("3C7CL");
            reports2Strs.add("3C8CL");
            reports2Strs.add("3#5#CL");
            reports2Strs.add("3#6#CL");
            reports2Strs.add("1#1#ZCL");
            reports2Strs.add("1FD");
            reports2Strs.add("2FD");
            reports2Strs.add("1CL");
            reports2Strs.add("2CL");
            reports2Strs.add("QC");
            reports2Strs.add("HC");
            reports2Strs.add("3C  6Z");
            reports2Strs.add("1W  BJ");
            reports2Strs.add("1WB FD");
            reports2Strs.add("2WBJ");
            reports2Strs.add("2W  XYX");
            reports2Strs.add("2W  MDCL");
            reports2Strs.add("1W  MDCL");
            reports2Strs.add("2W YYB FDX");
            reports2Strs.add("3C  3Z");
            reports2Strs.add("3C  1Z");
            reports2Strs.add("3C  4Z");
            reports2Strs.add("3C  5Z");
            reports2Strs.add("3C  2WJ");
            reports2Strs.add("4CJ");
            reports2Strs.add("1ZD");
            reports2Strs.add("2ZD");
            reports2Strs.add("1DZC");
            reports2Strs.add("2DZC");
            reports2Strs.add("3C1Z");
            reports2Strs.add("3C3Z");
            reports2Strs.add("3C4Z");
            reports2Strs.add("1WJF");
            reports2Strs.add("2WJFD");
            reports2Strs.add("SWJ");
            reports2Strs.add("XWJ");
            reports2Strs.add("7Z");
            reports2Strs.add("FD1");
            reports2Strs.add("FD2");
            reports2Strs.add("dd");
            reports2Strs.add("24Z");
            reports2Strs.add("1WB");
            reports2Strs.add("2WB");
            reports2Strs.add("12Z");
            reports2Strs.add("1ZX");
            reports2Strs.add("1MD");
            reports2Strs.add("2MD");
            reports2Strs.add("ZX");
            reports2Strs.add("ZXB");
            reports2Strs.add("1#ZX");
            reports2Strs.add("2#ZX");
            reports2Strs.add("1WBJQ");
            reports2Strs.add("2WBJQ");
            reports2Strs.add("FFD2");
            reports2Strs.add("ZXJ");
            reports2Strs.add("1CFD");
            reports2Strs.add("2CFD");
            reports2Strs.add("JS1");
            reports2Strs.add("2ZX");
            reports2Strs.add("1#BJ");
            reports2Strs.add("2#BJ");
            reports2Strs.add("CL");
            reports2Strs.add("3#zxmd");
            reports2Strs.add("3#zxmd(zuo)");
            reports2Strs.add("1WMDCL");
            reports2Strs.add("2WMDCL");
            reports2Strs.add("4Z1");
            reports2Strs.add("4Z2");
            reports2Strs.add("LQY1C");
            reports2Strs.add("3WFD");
            reports2Strs.add("3ZX");
            reports2Strs.add("J1Z");
            reports2Strs.add("LMD1Z");
            reports2Strs.add("LMD2Z");
            reports2Strs.add("DLFD5");
            reports2Strs.add("LMD3Z");
            reports2Strs.add("LMD4Z");
            reports2Strs.add("DLFD2");
            reports2Strs.add("JJS");
            reports2Strs.add("ZZD");
            reports2Strs.add("YZD");
            reports2Strs.add("FDX");
            reports2Strs.add("3C1WFD");
            reports2Strs.add("3C1WMD");
            reports2Strs.add("3#2WMD");
            reports2Strs.add("3#2WFD");
            reports2Strs.add("CLY(XIN)");
            reports2Strs.add("1# FD");
            reports2Strs.add("2# FD");
            reports2Strs.add("3C FDX");
            reports2Strs.add("1C FD");
            reports2Strs.add("BS1");
            reports2Strs.add("BS2");
            reports2Strs.add("DLCFD5");
            reports2Strs.add("DLCFD2");
            reports2Strs.add("ZDZ");
            reports2Strs.add("ZDY");
            reports2Strs.add("3#1WFD");
            reports2Strs.add("3#1WMD");
            reports2Strs.add("3C2WMD");
            reports2Strs.add("BSX");
            reports2Strs.add("ZY3Z");
            reports2Strs.add("LMDCL2W");
            reports2Strs.add("LMDCL4W");
            reports2Strs.add("LMDCL1W");
            reports2Strs.add("LMDCL3W");
            reports2Strs.add("ZY4Z");
            reports2Strs.add("5KDLFD");
            reports2Strs.add("DLCFDJ");
            reports2Strs.add("HZD");
        }
        if (reports3Strs.size() == 0) {
                reports3Strs.add("JY" );
                reports3Strs.add("FDJ" );
                reports3Strs.add("1#JY" );
                reports3Strs.add("2#JY" );
                reports3Strs.add("QJ" );
                reports3Strs.add("HJ" );
                reports3Strs.add("LMDJY" );
                reports3Strs.add("DLCJY" );
                reports3Strs.add("BYFDJ" );
                reports3Strs.add("JY1" );
                reports3Strs.add("JY2" );
                reports3Strs.add("FFJY" );
                reports3Strs.add("4#JY" );
                reports3Strs.add("5#JY" );
                reports3Strs.add("5#KYJ" );
                reports3Strs.add("1#CKYJ" );
                reports3Strs.add("2#CKYJ" );
                reports3Strs.add("3#C2WJY" );
                reports3Strs.add("4#KYJ" );
                reports3Strs.add("3#1WJY" );
                reports3Strs.add("3#1WKYJ" );
                reports3Strs.add("FZJY" );
                reports3Strs.add("3#2WKYJ" );
                reports3Strs.add("3#1WBJ" );
                reports3Strs.add("2CJY" );
                reports3Strs.add("1# CJY" );
                reports3Strs.add("2# CJY" );
                reports3Strs.add("1#KYJ" );
                reports3Strs.add("2#KYJ" );
                reports3Strs.add("FZFDJ" );
                reports3Strs.add("#JY" );
                reports3Strs.add("3#2WJY" );
                reports3Strs.add("2#FZFDJ" );
                reports3Strs.add("1#FZFDJ" );
                reports3Strs.add("CYJJY" );
                reports3Strs.add("FDJJY1" );
                reports3Strs.add("FDJJY2" );
                reports3Strs.add("CYJJY1" );
                reports3Strs.add("CYJJY2" );
                reports3Strs.add("FDJCJY2" );
                reports3Strs.add("FDJCJY1" );
                reports3Strs.add("1#CXJ" );
                reports3Strs.add("2#CXJ" );
                reports3Strs.add("3#JXJ" );
                reports3Strs.add("4#JXJ" );
                reports3Strs.add("4#TZJ" );
                reports3Strs.add("5#TZJ" );
                reports3Strs.add("QJY" );
                reports3Strs.add("HJY" );
                reports3Strs.add("J" );
                reports3Strs.add("1#J" );
                reports3Strs.add("2#J" );
                reports3Strs.add("3#J" );
                reports3Strs.add("5C FDJ" );
                reports3Strs.add("4C YJ" );
                reports3Strs.add("5C  KYJ" );
                reports3Strs.add("2C JY" );
                reports3Strs.add("1W KYJ" );
                reports3Strs.add("2W KYJ" );
                reports3Strs.add("1C JY" );
                reports3Strs.add("1C   KYJ" );
                reports3Strs.add("2C  HYJ" );
                reports3Strs.add("3C  1WJY" );
                reports3Strs.add("4C  FDJ" );
                reports3Strs.add("SHJ" );
                reports3Strs.add("1HJ" );
                reports3Strs.add("2HJ" );
                reports3Strs.add("KYJ" );
                reports3Strs.add("1JY" );
                reports3Strs.add("2JY" );
                reports3Strs.add("2CI" );
                reports3Strs.add("1CJ" );
                reports3Strs.add("2CJ" );
                reports3Strs.add("3C1WJ" );
                reports3Strs.add("3C2WJ" );
                reports3Strs.add("5CJ" );
                reports3Strs.add("3fj" );
                reports3Strs.add("ggg" );
                reports3Strs.add("J1" );
                reports3Strs.add("J2" );
                reports3Strs.add("J3" );
                reports3Strs.add("J4" );
                reports3Strs.add("1J" );
                reports3Strs.add("2J" );
                reports3Strs.add("PFJ" );
                reports3Strs.add("KYJ2" );
                reports3Strs.add("PFJY" );
                reports3Strs.add("1WKYJ" );
                reports3Strs.add("2WKYJ" );
                reports3Strs.add("1CKYJ" );
                reports3Strs.add("2CKYJ" );
                reports3Strs.add("4CKYJ" );
                reports3Strs.add("1#FDJY" );
                reports3Strs.add("2#FDJY" );
                reports3Strs.add("4#FDJY" );
                reports3Strs.add("5#FDJY" );
                reports3Strs.add("1ZXJY" );
                reports3Strs.add("2ZXJY" );
                reports3Strs.add("1WLQJ" );
                reports3Strs.add("2WLQJ" );
                reports3Strs.add("KYJ1" );
                reports3Strs.add("ZJ" );
                reports3Strs.add("FZJ" );
                reports3Strs.add("FF" );
                reports3Strs.add("SHFDJ" );
                reports3Strs.add("JY3" );
                reports3Strs.add("JY4" );
                reports3Strs.add("3#JY" );
                reports3Strs.add("SF" );
                reports3Strs.add("1KYJ" );
                reports3Strs.add("2KYJ" );
                reports3Strs.add("1#FDJ" );
                reports3Strs.add("2#FDJ" );
                reports3Strs.add("4#FDJ" );
                reports3Strs.add("5#FDJ" );
                reports3Strs.add("1WBJ" );
                reports3Strs.add("5CKYJ" );
                reports3Strs.add("3JY" );
                reports3Strs.add("4JY" );
                reports3Strs.add("3C1WJY" );
                reports3Strs.add("3C2WJY" );
                reports3Strs.add("4#CKYJ" );
                reports3Strs.add("5#CKYJ" );
                reports3Strs.add("3#FJ" );
                reports3Strs.add("FJ" );
                reports3Strs.add("JY5" );
                reports3Strs.add("3#1WFDJ" );
                reports3Strs.add("3#2WFDJ" );
                reports3Strs.add("3#KYJ1" );
                reports3Strs.add("3#KYJ2" );
                reports3Strs.add("1CFDJ" );
                reports3Strs.add("3CJ1" );
                reports3Strs.add("3CJ2" );
                reports3Strs.add("ZFJY" );
                reports3Strs.add("DLFDJ" );
                reports3Strs.add("1CJY" );
                reports3Strs.add("2CFDJ" );
                reports3Strs.add("4CFDJ" );
                reports3Strs.add("5CFDJ" );
                reports3Strs.add("3C1WKYJ" );
                reports3Strs.add("3C1WBJ" );
                reports3Strs.add("3C2WKYJ" );
                reports3Strs.add("3C1WFDJ" );
                reports3Strs.add("3C2WFDJ" );
                reports3Strs.add("3CFF" );
                reports3Strs.add("JYQ" );
                reports3Strs.add("1KY" );
                reports3Strs.add("SHFDJY" );
                reports3Strs.add("FFJ" );
                reports3Strs.add("3#2WKY" );
                reports3Strs.add("LMJY" );
                reports3Strs.add("DLJY" );
                reports3Strs.add("3C1WK" );
                reports3Strs.add("3C2WK" );
                reports3Strs.add("4CJY" );
                reports3Strs.add("JY(XIN)" );
                reports3Strs.add("DCJY" );
                reports3Strs.add("#1WJY" );
                reports3Strs.add("3C JY" );
                reports3Strs.add("LMDFDJ" );
                reports3Strs.add("BYJ" );
                reports3Strs.add("2#FKYJ" );
                reports3Strs.add("3#2J" );
                reports3Strs.add("3#1J" );
                reports3Strs.add("3#2KYJ" );
                reports3Strs.add("2FDJ" );
                reports3Strs.add("3FDJ" );
                reports3Strs.add("4FDJ" );
                reports3Strs.add("5FDJ" );
                reports3Strs.add("1FDJ" );
                reports3Strs.add("3#2FDJ" );
                reports3Strs.add("ZFDJY" );
                reports3Strs.add("BYFDJY" );
                reports3Strs.add("1# JY");
        }
    }

    //1号检测标准 三位 齿轮
    public List<Map<String, String>> reports2(OilSampleDetectionVo vo) {
        List<Map<String, String>> result = new ArrayList<>();
        Map<String, String> feM = new HashMap<>();
        feM.put("label", "oilFe");
        Double fe = StringUtils.isNotBlank(vo.getOilFe()) ? 0.0 : Double.parseDouble(vo.getOilFe());
        if (fe < 200) {
            feM.put("val", "正常");
        } else if (fe >= 200 && fe <= 800) {
            feM.put("val", "观察");
        } else {
            feM.put("val", "异常");
        }
        result.add(feM);
        Map<String, String> cuM = new HashMap<>();
        cuM.put("label", "oilCu");
        Double cu = StringUtils.isNotBlank(vo.getOilCu()) ? 0.0 : Double.parseDouble(vo.getOilCu());
        if (cu < 50) {
            cuM.put("val", "正常");
        } else if (cu >= 50 && cu <= 100) {
            cuM.put("val", "观察");
        } else {
            cuM.put("val", "异常");
        }
        result.add(cuM);
        Map<String, String> siM = new HashMap<>();
        siM.put("label", "oilSi");
        Double si = StringUtils.isNotBlank(vo.getOilSi()) ? 0.0 : Double.parseDouble(vo.getOilSi());
        if (si < 120) {
            siM.put("val", "正常");
        } else if (si >= 120 && si <= 400) {
            siM.put("val", "观察");
        } else {
            siM.put("val", "异常");
        }
        result.add(siM);
        return result;
    }

    //2号检测标准 ZF
    public List<Map<String, String>> reports1(OilSampleDetectionVo vo) {
        List<Map<String, String>> result = new ArrayList<>();
        Map<String, String> feM = new HashMap<>();
        feM.put("label", "oilFe");
        Double fe = StringUtils.isNotBlank(vo.getOilFe()) ? 0.0 : Double.parseDouble(vo.getOilFe());
        if (fe < 180) {
            feM.put("val", "正常");
        } else if (fe >= 180 && fe <= 250) {
            feM.put("val", "观察");
        } else {
            feM.put("val", "异常");
        }
        result.add(feM);
        Map<String, String> alM = new HashMap<>();
        alM.put("label", "oilAl");
        Double al = StringUtils.isNotBlank(vo.getOilAl()) ? 0.0 : Double.parseDouble(vo.getOilAl());
        if (al < 80) {
            alM.put("val", "正常");
        } else if (al >= 80 && al <= 120) {
            alM.put("val", "观察");
        } else {
            alM.put("val", "异常");
        }
        result.add(alM);
        Map<String, String> cuM = new HashMap<>();
        cuM.put("label", "oilCu");
        Double cu = StringUtils.isNotBlank(vo.getOilCu()) ? 0.0 : Double.parseDouble(vo.getOilCu());
        if (cu < 200) {
            cuM.put("val", "正常");
        } else if (cu >= 200 && cu <= 300) {
            cuM.put("val", "观察");
        } else {
            cuM.put("val", "异常");
        }
        result.add(cuM);

        Map<String, String> pbM = new HashMap<>();
        pbM.put("label", "oilPb");
        Double pb = StringUtils.isNotBlank(vo.getOilPb()) ? 0.0 : Double.parseDouble(vo.getOilPb());
        if (pb < 600) {
            pbM.put("val", "正常");
        } else if (pb >= 600 && pb <= 1000) {
            pbM.put("val", "观察");
        } else {
            pbM.put("val", "异常");
        }
        result.add(pbM);

        Map<String, String> siM = new HashMap<>();
        siM.put("label", "oilSi");
        Double si = StringUtils.isNotBlank(vo.getOilSi()) ? 0.0 : Double.parseDouble(vo.getOilSi());
        if (si < 600) {
            siM.put("val", "正常");
        } else if (si >= 600 && si <= 1000) {
            siM.put("val", "观察");
        } else {
            siM.put("val", "异常");
        }
        result.add(siM);
        return result;
    }

    //3号检测标准 机油
    public List<Map<String, String>> reports3(OilSampleDetectionVo vo) {
        List<Map<String, String>> result = new ArrayList<>();
        Map<String, String> feM = new HashMap<>();
        feM.put("label", "oilFe");
        Double fe = StringUtils.isNotBlank(vo.getOilFe()) ? 0.0 : Double.parseDouble(vo.getOilFe());
        if (fe < 120) {
            feM.put("val", "正常");
        } else if (fe >= 120 && fe <= 200) {
            feM.put("val", "观察");
        } else {
            feM.put("val", "异常");
        }
        result.add(feM);
        Map<String, String> alM = new HashMap<>();
        alM.put("label", "oilAl");
        Double al = StringUtils.isNotBlank(vo.getOilAl()) ? 0.0 : Double.parseDouble(vo.getOilAl());
        if (al < 100) {
            alM.put("val", "正常");
        } else if (al >= 100 && al <= 200) {
            alM.put("val", "观察");
        } else {
            alM.put("val", "异常");
        }
        result.add(alM);
        Map<String, String> cuM = new HashMap<>();
        cuM.put("label", "oilCu");
        Double cu = StringUtils.isNotBlank(vo.getOilCu()) ? 0.0 : Double.parseDouble(vo.getOilCu());
        if (cu < 50) {
            cuM.put("val", "正常");
        } else if (cu >= 50 && cu <= 200) {
            cuM.put("val", "观察");
        } else {
            cuM.put("val", "异常");
        }
        result.add(cuM);

        Map<String, String> pbM = new HashMap<>();
        pbM.put("label", "oilPb");
        Double pb = StringUtils.isNotBlank(vo.getOilPb()) ? 0.0 : Double.parseDouble(vo.getOilPb());
        if (pb < 30) {
            pbM.put("val", "正常");
        } else if (pb >= 30 && pb <= 50) {
            pbM.put("val", "观察");
        } else {
            pbM.put("val", "异常");
        }
        result.add(pbM);

        Map<String, String> siM = new HashMap<>();
        siM.put("label", "oilSi");
        Double si = StringUtils.isNotBlank(vo.getOilSi()) ? 0.0 : Double.parseDouble(vo.getOilSi());
        if (si < 50) {
            siM.put("val", "正常");
        } else if (si >= 50 && si <= 150) {
            siM.put("val", "观察");
        } else {
            siM.put("val", "异常");
        }
        result.add(siM);
        return result;
    }

    @Override
    public DrDamperDataVo selectDamperDataById(Long id) {
        return drDamperDataMapper.selectVoById(id);
    }

    //_MCGS表插入数据
    @Override
    public void insertMcgs0000(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0000(mcgsTime)) {
                insertData0000(line);
            }
        }
    }

    //"MCGS_AlarmInfo"表插入数据
    @Override
    public void insertMcgs0001(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0001(mcgsTime)) {
                insertData0001(line);
            }
        }
    }

    // 检查mcgs_alarm_info表数据是否存在
    private boolean dataExists0001(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_alarm_info WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0002(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0002(mcgsTime)) {
                insertData0002(line);
            }
        }
    }

    // 检查mcgs_qj1_qdjcz表数据是否存在
    private boolean dataExists0002(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_qj1_qdjcz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0003(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0003(mcgsTime)) {
                insertData0003(line);
            }
        }
    }

    // 检查mcgs_qk1_qkfz表数据是否存在
    private boolean dataExists0003(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_qk1_qkfz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0004(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0004(mcgsTime)) {
                insertData0004(line);
            }
        }
    }

    // 检查mcgs_zdfz表数据是否存在
    private boolean dataExists0004(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_zdfz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0005(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0005(mcgsTime)) {
                insertData0005(line);
            }
        }
    }

    // 检查mcgs_fpf_109e_zybz表数据是否存在
    private boolean dataExists0005(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_fpf_109e_zybz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0006(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0006(mcgsTime)) {
                insertData0006(line);
            }
        }
    }

    //mcgs_fpf_109e_jhbz表数据
    private boolean dataExists0006(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_fpf_109e_jhbz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0007(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0007(mcgsTime)) {
                insertData0007(line);
            }
        }
    }

    // 检查mcgs_fpf_109ez表数据是否存在
    private boolean dataExists0007(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_fpf_109ez WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0008(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0008(mcgsTime)) {
                insertData0008(line);
            }
        }
    }

    // 检查mcgs_fpfz表数据是否存在
    private boolean dataExists0008(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_fpfz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0009(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0009(mcgsTime)) {
                insertData0009(line);
            }
        }
    }

    // 检查mcgs_xzz表数据是否存在
    private boolean dataExists0009(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_xzz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0010(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0010(mcgsTime)) {
                insertData00010(line);
            }
        }
    }

    // 检查mcgs_xzz1表数据是否存在
    private boolean dataExists0010(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_xzz1 WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0011(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0011(mcgsTime)) {
                insertData00011(line);
            }
        }
    }

    // 检查mcgs_jjf1z表数据是否存在
    private boolean dataExists0011(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_jjf1z WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0012(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0012(mcgsTime)) {
                insertData00012(line);
            }
        }
    }

    // 检查mcgs_jjf2z表数据是否存在
    private boolean dataExists0012(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_jjf2z WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0013(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0013(mcgsTime)) {
                insertData00013(line);
            }
        }
    }

    // 检查mcgs_jjfz表数据是否存在
    private boolean dataExists0013(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_jjfz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0014(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0014(mcgsTime)) {
                insertData00014(line);
            }
        }
    }

    // 检查mcgs_zchz表数据是否存在
    private boolean dataExists0014(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_zchz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertMcgs0015(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String mcgsTime = line.getStr("MCGS_Time");
            if (!dataExists0015(mcgsTime)) {
                insertData00015(line);
            }
        }
    }

    // 检查mcgs_zdfz表数据是否存在
    private boolean dataExists0015(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_zdfz WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    @Override
    public void insertDrDamperData(JSONArray lines) {
        for (int i = 0; i < lines.size(); i++) {
            JSONObject line = lines.getJSONObject(i);
            String DamperType = line.getStr("DamperType");
            String CarNo = line.getStr("CarNo");
            String TestDate = line.getStr("TestDate");
            if (!dataExists2(DamperType, CarNo, TestDate)) {
                insertDrDamper(line);
            }
        }
    }

    @Override
    public TableDataInfo<OilSampleDetectionVo> selectOilTable(String lmtNumber, String oilType, PageQuery pageQuery) {
        //查询符合条件的内容
        List<OilSampleDetectionVo> result = oilSampleDetectionMapper.selectOilNew(lmtNumber, oilType);
        //分页
        if (pageQuery.getPageSize() != null && pageQuery.getPageNum() != null) {
            List<OilSampleDetectionVo> page = ListUtil.page(pageQuery.getPageNum() - 1, pageQuery.getPageSize(), result);
            TableDataInfo res = new TableDataInfo<>(page, result.size());
            return res;
        } else {
            return TableDataInfo.build(result);
        }
    }

    @Override
    public OilSampleDetectionVo selectOilDate(String lmtNumber, String oilType, String oilData) {
        OilSampleDetectionVo vo = oilSampleDetectionMapper.selectOilDate(lmtNumber, oilType, oilData);
        if (vo != null) {
            if (StringUtils.isNotBlank(vo.getOilType())) {
                setReportStrs();
                if (reports1Strs.contains(vo.getOilType())) {
                    vo.setReports(reports1(vo));
                } else if (reports2Strs.contains(vo.getOilType())) {
                    vo.setReports(reports2(vo));
                } else if (reports3Strs.contains(vo.getOilType())) {
                    vo.setReports(reports3(vo));
                }
            }
        }
        return vo;
    }

    // 检查数据是否存在
    private boolean dataExists2(String DamperType, String CarNo, String TestDate) {
        String sql = "SELECT COUNT(*) FROM dr_damper_data WHERE dr_damper_type = ? AND dr_car_no = ? AND dr_test_date = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{DamperType, CarNo, TestDate}, Integer.class);
        return count != null && count > 0;
    }

    // 检查数据是否存在
    private boolean dataExists0000(String mcgsTime) {
        String sql = "SELECT COUNT(*) FROM mcgs_info WHERE mcgs_time = ?";
        Integer count = jdbcTemplate.queryForObject(sql, new Object[]{mcgsTime}, Integer.class);
        return count != null && count > 0;
    }

    // 插入数据
    private Boolean insertData0000(JSONObject data) {
        McgsInfoBo mcgsInfoBo = new McgsInfoBo();
        mcgsInfoBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsInfoBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsInfoBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsInfoBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsInfoBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsInfoBo.setMcgsQj11(data.getStr("QJ1气动集成检查口应停止排风", ""));
        mcgsInfoBo.setMcgsQj12(data.getStr("QJ1气动集成检查口应有风猛烈排出", ""));
        mcgsInfoBo.setMcgsQj13(data.getStr("QJ1气动集成检查口应有风排出", ""));
        mcgsInfoBo.setMcgsQj14(data.getStr("QJ1气动集成遮断检查口泄漏", ""));
        mcgsInfoBo.setMcgsQj15(data.getStr("检查QJ1气动集成作用管压力", ""));
        mcgsInfoBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsInfoBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsInfoBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsInfoBo.setMcgsFpf1(data.getStr("分配阀g1孔状态", ""));
        mcgsInfoBo.setMcgsFpf2(data.getStr("分配阀补风灵敏度", ""));
        mcgsInfoBo.setMcgsFpf3(data.getStr("分配阀大膜板状态", ""));
        mcgsInfoBo.setMcgsFpf4(data.getStr("分配阀单缓性能", ""));
        mcgsInfoBo.setMcgsFpf5(data.getStr("分配阀工作充风时间", ""));
        mcgsInfoBo.setMcgsFpf6(data.getStr("分配阀缓解灵敏度时间", ""));
        mcgsInfoBo.setMcgsFpf7(data.getStr("分配阀节止阀状态", ""));
        mcgsInfoBo.setMcgsFpf8(data.getStr("分配阀结合部状态", ""));
        mcgsInfoBo.setMcgsFpf9(data.getStr("分配阀紧急增压阀上O型圈状态", ""));
        mcgsInfoBo.setMcgsFpf10(data.getStr("分配阀紧急增压阀下O型圈状态", ""));
        mcgsInfoBo.setMcgsFpf11(data.getStr("分配阀紧急增压阀状态", ""));
        mcgsInfoBo.setMcgsFpf12(data.getStr("分配阀紧急制动上闸时间", ""));
        mcgsInfoBo.setMcgsFpf13(data.getStr("分配阀紧急制动上闸时间慢", ""));
        mcgsInfoBo.setMcgsFpf14(data.getStr("分配阀均衡部供气阀口状态", ""));
        mcgsInfoBo.setMcgsFpf15(data.getStr("分配阀均衡部膜板状态", ""));
        mcgsInfoBo.setMcgsFpf16(data.getStr("分配阀均衡部排气阀口状态", ""));
        mcgsInfoBo.setMcgsFpf17(data.getStr("分配阀全缓解时间", ""));
        mcgsInfoBo.setMcgsFpf18(data.getStr("分配阀全缓解状态", ""));
        mcgsInfoBo.setMcgsFpf19(data.getStr("分配阀稳定性性能", ""));
        mcgsInfoBo.setMcgsFpf20(data.getStr("分配阀主阀部灵敏度低", ""));
        mcgsInfoBo.setMcgsFpf21(data.getStr("分配阀最小作用压力", ""));
        mcgsInfoBo.setMcgsKzc(data.getStr("空重车调整装置闸缸压力", ""));
        mcgsInfoBo.setMcgsXz1(data.getStr("小闸818凸轮状态", ""));
        mcgsInfoBo.setMcgsXz2(data.getStr("小闸电空位缓解时间", ""));
        mcgsInfoBo.setMcgsXz3(data.getStr("小闸电空位开关状态", ""));
        mcgsInfoBo.setMcgsXz4(data.getStr("小闸调压阀管堵判断", ""));
        mcgsInfoBo.setMcgsXz5(data.getStr("小闸缓解柱塞1判断", ""));
        mcgsInfoBo.setMcgsXz6(data.getStr("小闸缓解柱塞2判断", ""));
        mcgsInfoBo.setMcgsXz7(data.getStr("小闸缓解柱塞缩孔状态", ""));
        mcgsInfoBo.setMcgsXz8(data.getStr("小闸缓解柱塞凸轮状态", ""));
        mcgsInfoBo.setMcgsXz9(data.getStr("小闸均衡堵塞判断", ""));
        mcgsInfoBo.setMcgsXz10(data.getStr("小闸开关818状态", ""));
        mcgsInfoBo.setMcgsXz11(data.getStr("小闸空气位均衡充风时间", ""));
        mcgsInfoBo.setMcgsXz12(data.getStr("小闸排风阀口开度状态", ""));
        mcgsInfoBo.setMcgsXz13(data.getStr("小闸排风阀口状态", ""));
        mcgsInfoBo.setMcgsXz14(data.getStr("小闸全制动减压时间", ""));
        mcgsInfoBo.setMcgsXz15(data.getStr("小闸上闸慢", ""));
        mcgsInfoBo.setMcgsXz16(data.getStr("小闸上闸时间", ""));
        mcgsInfoBo.setMcgsXz17(data.getStr("小闸转换柱塞O型圈1状态", ""));
        mcgsInfoBo.setMcgsXz18(data.getStr("小闸转换柱塞O型圈2状态", ""));
        mcgsInfoBo.setMcgsXz19(data.getStr("小闸转换柱塞O型圈3状态", ""));
        mcgsInfoBo.setMcgsXljc(data.getStr("小闸泄漏检查窗口显示", ""));
        mcgsInfoBo.setMcgsXz20(data.getStr("小闸指示D1状态", ""));
        mcgsInfoBo.setMcgsJhb109e1(data.getStr("均衡部109E补风性能差", ""));
        mcgsInfoBo.setMcgsJhb109e2(data.getStr("均衡部109E大膜板泄漏", ""));
        mcgsInfoBo.setMcgsJhb109e3(data.getStr("均衡部109E弹簧不合格", ""));
        mcgsInfoBo.setMcgsJhb109e4(data.getStr("均衡部109E供气阀口泄漏", ""));
        mcgsInfoBo.setMcgsJhb109e5(data.getStr("均衡部109E缓解弹簧不合格", ""));
        mcgsInfoBo.setMcgsJhb109e6(data.getStr("均衡部109E空心杆O型圈泄漏", ""));
        mcgsInfoBo.setDelFlag("0");
        mcgsInfoBo.setCreateBy("admin");
        mcgsInfoBo.setUpdateBy("admin");
        return mcgsInfoService.insertByBo(mcgsInfoBo);

    }

    // 插入数据
    private Boolean insertData0001(JSONObject data) {
        McgsAlarmInfoBo mcgsAlarmInfoBo = new McgsAlarmInfoBo();
        mcgsAlarmInfoBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsAlarmInfoBo.setMcgsAlarmId(data.getStr("AlarmID", ""));
        mcgsAlarmInfoBo.setMcgsAlmName(data.getStr("AlmName", ""));
        mcgsAlarmInfoBo.setMcgsTimeS(data.getStr("TimeS", ""));
        mcgsAlarmInfoBo.setMcgsTimeSms(data.getStr("TimeSMS", ""));
        mcgsAlarmInfoBo.setMcgsTimeE(data.getStr("TimeE", ""));
        mcgsAlarmInfoBo.setMcgsTimeEms(data.getStr("TimeEMS", ""));
        mcgsAlarmInfoBo.setMcgsTimeA(data.getStr("TimeA", ""));
        mcgsAlarmInfoBo.setMcgsTimeAms(data.getStr("TimeAMS", ""));
        mcgsAlarmInfoBo.setMcgsId(data.getStr("ID", ""));
        mcgsAlarmInfoBo.setMcgsType(data.getStr("Type", ""));
        mcgsAlarmInfoBo.setMcgsLimitValue(data.getStr("LimitValue", ""));
        mcgsAlarmInfoBo.setMcgsStandValue(data.getStr("StandValue", ""));
        mcgsAlarmInfoBo.setMcgsInfo(data.getStr("Info", ""));
        mcgsAlarmInfoBo.setDelFlag("0");
        mcgsAlarmInfoBo.setCreateBy("admin");
        mcgsAlarmInfoBo.setUpdateBy("admin");
        return mcgsAlarmInfoService.insertByBo(mcgsAlarmInfoBo);

    }

    private Boolean insertData0002(JSONObject data) {
        McgsQj1QdjczBo mcgsQj1QdjczBo = new McgsQj1QdjczBo();
        mcgsQj1QdjczBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsQj1QdjczBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsQj1QdjczBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsQj1QdjczBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsQj1QdjczBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsQj1QdjczBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsQj1QdjczBo.setMcgsQj11(data.getStr("QJ1气动集成检查口应停止排风", ""));
        mcgsQj1QdjczBo.setMcgsQj12(data.getStr("QJ1气动集成检查口应有风猛烈排出", ""));
        mcgsQj1QdjczBo.setMcgsQj13(data.getStr("QJ1气动集成检查口应有风排出", ""));
        mcgsQj1QdjczBo.setMcgsQj14(data.getStr("QJ1气动集成遮断检查口泄漏", ""));
        mcgsQj1QdjczBo.setMcgsQj15(data.getStr("检查QJ1气动集成作用管压力", ""));
        mcgsQj1QdjczBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsQj1QdjczBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsQj1QdjczBo.setDelFlag("0");
        mcgsQj1QdjczBo.setCreateBy("admin");
        mcgsQj1QdjczBo.setUpdateBy("admin");
        return iMcgsQj1QdjczService.insertByBo(mcgsQj1QdjczBo);
    }

    private Boolean insertData0003(JSONObject data) {
        McgsQk1QkfzBo mcgsQk1QkfzBo = new McgsQk1QkfzBo();
        mcgsQk1QkfzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsQk1QkfzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsQk1QkfzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsQk1QkfzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsQk1QkfzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsQk1QkfzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsQk1QkfzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsQk1QkfzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsQk1QkfzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsQk1QkfzBo.setMcgsZdf4(data.getStr("遮断阀供气阀口泄漏", ""));
        mcgsQk1QkfzBo.setMcgsJxbhsr(data.getStr("检修编号输入", ""));
        mcgsQk1QkfzBo.setMcgsZdf1(data.getStr("遮断阀大鞲鞴泄漏", ""));
        mcgsQk1QkfzBo.setMcgsZdf2(data.getStr("遮断阀小鞲鞴泄漏", ""));
        mcgsQk1QkfzBo.setMcgsZdf3(data.getStr("遮断阀供气阀开度", ""));
        mcgsQk1QkfzBo.setDelFlag("0");
        mcgsQk1QkfzBo.setCreateBy("admin");
        mcgsQk1QkfzBo.setUpdateBy("admin");
        return iMcgsQk1QkfzService.insertByBo(mcgsQk1QkfzBo);
    }

    private Boolean insertData0004(JSONObject data) {
        McgsZjfzBo mcgsZjfzBo = new McgsZjfzBo();
        mcgsZjfzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsZjfzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsZjfzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsZjfzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsZjfzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsZjfzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsZjfzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsZjfzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsZjfzBo.setMcgsZjf1(data.getStr("中继阀大鞲鞴判断", ""));
        mcgsZjfzBo.setMcgsZjf2(data.getStr("中继阀顶杆状态", ""));
        mcgsZjfzBo.setMcgsZjf3(data.getStr("中继阀阀体结合部状态", ""));
        mcgsZjfzBo.setMcgsZjf4(data.getStr("中继阀供风时间", ""));
        mcgsZjfzBo.setMcgsZjf5(data.getStr("中继阀供气阀弹簧状态", ""));
        mcgsZjfzBo.setMcgsZjf6(data.getStr("中继阀供气阀泄漏", ""));
        mcgsZjfzBo.setMcgsZjf7(data.getStr("中继阀鞲鞴灵敏度", ""));
        mcgsZjfzBo.setMcgsZjf8(data.getStr("中继阀过充柱塞O型圈1", ""));
        mcgsZjfzBo.setMcgsZjf9(data.getStr("中继阀过充柱塞O型圈2状态", ""));
        mcgsZjfzBo.setMcgsZjf10(data.getStr("中继阀过充柱塞卡滞", ""));
        mcgsZjfzBo.setMcgsZjf11(data.getStr("中继阀列车均衡平衡时间", ""));
        mcgsZjfzBo.setMcgsZjf12(data.getStr("中继阀膜板压差", ""));
        mcgsZjfzBo.setMcgsZjf13(data.getStr("中继阀排气阀弹簧状态", ""));
        mcgsZjfzBo.setMcgsZjf14(data.getStr("中继阀排气阀口状态", ""));
        mcgsZjfzBo.setDelFlag("0");
        mcgsZjfzBo.setCreateBy("admin");
        mcgsZjfzBo.setUpdateBy("admin");
        return iMcgsZjfzService.insertByBo(mcgsZjfzBo);
    }

    private Boolean insertData0005(JSONObject data) {
        McgsFpf109eZybzBo mcgsFpf109eZybzBo = new McgsFpf109eZybzBo();
        mcgsFpf109eZybzBo.setDjNo(data.getStr("车号", "C001"));
        mcgsFpf109eZybzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsFpf109eZybzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsFpf109eZybzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsFpf109eZybzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsFpf109eZybzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsFpf109eZybzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsFpf109eZybzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsFpf109eZybzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsFpf109eZybzBo.setMcgsFpf1(data.getStr("分配阀g1孔状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf2(data.getStr("分配阀补风灵敏度", ""));
        mcgsFpf109eZybzBo.setMcgsFpf3(data.getStr("分配阀大膜板状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf4(data.getStr("分配阀单缓性能", ""));
        mcgsFpf109eZybzBo.setMcgsFpf5(data.getStr("分配阀工作充风时间", ""));
        mcgsFpf109eZybzBo.setMcgsFpf6(data.getStr("分配阀缓解灵敏度时间", ""));
        mcgsFpf109eZybzBo.setMcgsFpf7(data.getStr("分配阀节止阀状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf8(data.getStr("分配阀结合部状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf9(data.getStr("分配阀紧急增压阀上O型圈状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf10(data.getStr("分配阀紧急增压阀下O型圈状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf11(data.getStr("分配阀紧急增压阀状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf12(data.getStr("分配阀紧急制动上闸时间", ""));
        mcgsFpf109eZybzBo.setMcgsFpf13(data.getStr("分配阀紧急制动上闸时间慢", ""));
        mcgsFpf109eZybzBo.setMcgsFpf14(data.getStr("分配阀均衡部供气阀口状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf15(data.getStr("分配阀均衡部膜板状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf16(data.getStr("分配阀均衡部排气阀口状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf17(data.getStr("分配阀全缓解时间", ""));
        mcgsFpf109eZybzBo.setMcgsFpf18(data.getStr("分配阀全缓解状态", ""));
        mcgsFpf109eZybzBo.setMcgsFpf19(data.getStr("分配阀稳定性性能", ""));
        mcgsFpf109eZybzBo.setMcgsFpf20(data.getStr("分配阀主阀部灵敏度低", ""));
        mcgsFpf109eZybzBo.setMcgsFpf21(data.getStr("分配阀最小作用压力", ""));
        mcgsFpf109eZybzBo.setMcgsKzc(data.getStr("空重车调整装置闸缸压力", ""));
        mcgsFpf109eZybzBo.setDelFlag("0");
        mcgsFpf109eZybzBo.setCreateBy("admin");
        mcgsFpf109eZybzBo.setUpdateBy("admin");
        return iMcgsFpf109eZybzService.insertByBo(mcgsFpf109eZybzBo);
    }

    private Boolean insertData0006(JSONObject data) {
        McgsFpf109eJhbzBo mcgsFpf109eJhbzBo = new McgsFpf109eJhbzBo();
        mcgsFpf109eJhbzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsFpf109eJhbzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsFpf109eJhbzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsFpf109eJhbzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsFpf109eJhbzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsFpf109eJhbzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsFpf109eJhbzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsFpf109eJhbzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsFpf109eJhbzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsFpf109eJhbzBo.setMcgsJhb109e1(data.getStr("均衡部109E补风性能差", ""));
        mcgsFpf109eJhbzBo.setMcgsJhb109e2(data.getStr("均衡部109E大膜板泄漏", ""));
        mcgsFpf109eJhbzBo.setMcgsJhb109e3(data.getStr("均衡部109E弹簧不合格", ""));
        mcgsFpf109eJhbzBo.setMcgsJhb109e4(data.getStr("均衡部109E供气阀口泄漏", ""));
        mcgsFpf109eJhbzBo.setMcgsJhb109e5(data.getStr("均衡部109E缓解弹簧不合格", ""));
        mcgsFpf109eJhbzBo.setMcgsJhb109e6(data.getStr("均衡部109E空心杆O型圈泄漏", ""));
        mcgsFpf109eJhbzBo.setMcgsKzc(data.getStr("空重车调整装置闸缸压力", ""));
        mcgsFpf109eJhbzBo.setDelFlag("0");
        mcgsFpf109eJhbzBo.setCreateBy("admin");
        mcgsFpf109eJhbzBo.setUpdateBy("admin");
        return iMcgsFpf109eJhbzService.insertByBo(mcgsFpf109eJhbzBo);
    }

    private Boolean insertData0007(JSONObject data) {
        McgsFpf109ezBo mcgsFpf109ezBo = new McgsFpf109ezBo();
        mcgsFpf109ezBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsFpf109ezBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsFpf109ezBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsFpf109ezBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsFpf109ezBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsFpf109ezBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsFpf109ezBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsFpf109ezBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsFpf109ezBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsFpf109ezBo.setMcgsFpf1(data.getStr("分配阀g1孔状态", ""));
        mcgsFpf109ezBo.setMcgsFpf2(data.getStr("分配阀补风灵敏度", ""));
        mcgsFpf109ezBo.setMcgsFpf3(data.getStr("分配阀大膜板状态", ""));
        mcgsFpf109ezBo.setMcgsFpf4(data.getStr("分配阀单缓性能", ""));
        mcgsFpf109ezBo.setMcgsFpf5(data.getStr("分配阀工作充风时间", ""));
        mcgsFpf109ezBo.setMcgsFpf6(data.getStr("分配阀缓解灵敏度时间", ""));
        mcgsFpf109ezBo.setMcgsFpf7(data.getStr("分配阀节止阀状态", ""));
        mcgsFpf109ezBo.setMcgsFpf8(data.getStr("分配阀结合部状态", ""));
        mcgsFpf109ezBo.setMcgsFpf9(data.getStr("分配阀紧急增压阀上O型圈状态", ""));
        mcgsFpf109ezBo.setMcgsFpf10(data.getStr("分配阀紧急增压阀下O型圈状态", ""));
        mcgsFpf109ezBo.setMcgsFpf11(data.getStr("分配阀紧急增压阀状态", ""));
        mcgsFpf109ezBo.setMcgsFpf12(data.getStr("分配阀紧急制动上闸时间", ""));
        mcgsFpf109ezBo.setMcgsFpf13(data.getStr("分配阀紧急制动上闸时间慢", ""));
        mcgsFpf109ezBo.setMcgsFpf14(data.getStr("分配阀均衡部供气阀口状态", ""));
        mcgsFpf109ezBo.setMcgsFpf15(data.getStr("分配阀均衡部膜板状态", ""));
        mcgsFpf109ezBo.setMcgsFpf16(data.getStr("分配阀均衡部排气阀口状态", ""));
        mcgsFpf109ezBo.setMcgsFpf17(data.getStr("分配阀全缓解时间", ""));
        mcgsFpf109ezBo.setMcgsFpf18(data.getStr("分配阀全缓解状态", ""));
        mcgsFpf109ezBo.setMcgsFpf19(data.getStr("分配阀稳定性性能", ""));
        mcgsFpf109ezBo.setMcgsFpf20(data.getStr("分配阀主阀部灵敏度低", ""));
        mcgsFpf109ezBo.setMcgsFpf21(data.getStr("分配阀最小作用压力", ""));
        mcgsFpf109ezBo.setMcgsKzc(data.getStr("空重车调整装置闸缸压力", ""));
        mcgsFpf109ezBo.setDelFlag("0");
        mcgsFpf109ezBo.setCreateBy("admin");
        mcgsFpf109ezBo.setUpdateBy("admin");
        return iMcgsFpf109ezService.insertByBo(mcgsFpf109ezBo);
    }

    private Boolean insertData0008(JSONObject data) {
        McgsFpfzBo mcgsFpfzBo = new McgsFpfzBo();
        mcgsFpfzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsFpfzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsFpfzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsFpfzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsFpfzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsFpfzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsFpfzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsFpfzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsFpfzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsFpfzBo.setMcgsFpf1(data.getStr("分配阀g1孔状态", ""));
        mcgsFpfzBo.setMcgsFpf2(data.getStr("分配阀补风灵敏度", ""));
        mcgsFpfzBo.setMcgsFpf3(data.getStr("分配阀大膜板状态", ""));
        mcgsFpfzBo.setMcgsFpf4(data.getStr("分配阀单缓性能", ""));
        mcgsFpfzBo.setMcgsFpf5(data.getStr("分配阀工作充风时间", ""));
        mcgsFpfzBo.setMcgsFpf6(data.getStr("分配阀缓解灵敏度时间", ""));
        mcgsFpfzBo.setMcgsFpf7(data.getStr("分配阀节止阀状态", ""));
        mcgsFpfzBo.setMcgsFpf8(data.getStr("分配阀结合部状态", ""));
        mcgsFpfzBo.setMcgsFpf9(data.getStr("分配阀紧急增压阀上O型圈状态", ""));
        mcgsFpfzBo.setMcgsFpf10(data.getStr("分配阀紧急增压阀下O型圈状态", ""));
        mcgsFpfzBo.setMcgsFpf11(data.getStr("分配阀紧急增压阀状态", ""));
        mcgsFpfzBo.setMcgsFpf12(data.getStr("分配阀紧急制动上闸时间", ""));
        mcgsFpfzBo.setMcgsFpf13(data.getStr("分配阀紧急制动上闸时间慢", ""));
        mcgsFpfzBo.setMcgsFpf14(data.getStr("分配阀均衡部供气阀口状态", ""));
        mcgsFpfzBo.setMcgsFpf15(data.getStr("分配阀均衡部膜板状态", ""));
        mcgsFpfzBo.setMcgsFpf16(data.getStr("分配阀均衡部排气阀口状态", ""));
        mcgsFpfzBo.setMcgsFpf17(data.getStr("分配阀全缓解时间", ""));
        mcgsFpfzBo.setMcgsFpf18(data.getStr("分配阀全缓解状态", ""));
        mcgsFpfzBo.setMcgsFpf19(data.getStr("分配阀稳定性性能", ""));
        mcgsFpfzBo.setMcgsFpf20(data.getStr("分配阀主阀部灵敏度低", ""));
        mcgsFpfzBo.setMcgsFpf21(data.getStr("分配阀最小作用压力", ""));
        mcgsFpfzBo.setMcgsKzc(data.getStr("空重车调整装置闸缸压力", ""));
        mcgsFpfzBo.setMcgsBy4(data.getStr("备用4", ""));
        mcgsFpfzBo.setDelFlag("0");
        mcgsFpfzBo.setCreateBy("admin");
        mcgsFpfzBo.setUpdateBy("admin");
        return iMcgsFpfzService.insertByBo(mcgsFpfzBo);
    }

    private Boolean insertData0009(JSONObject data) {
        McgsXzzBo mcgsXzzBo = new McgsXzzBo();
        mcgsXzzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsXzzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsXzzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsXzzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsXzzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsXzzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsXzzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsXzzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsXzzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsXzzBo.setMcgsXz1(data.getStr("小闸818凸轮状态", ""));
        mcgsXzzBo.setMcgsXz2(data.getStr("小闸电空位缓解时间", ""));
        mcgsXzzBo.setMcgsXz3(data.getStr("小闸电空位开关状态", ""));
        mcgsXzzBo.setMcgsXz4(data.getStr("小闸调压阀管堵判断", ""));
        mcgsXzzBo.setMcgsXz5(data.getStr("小闸缓解柱塞1判断", ""));
        mcgsXzzBo.setMcgsXz6(data.getStr("小闸缓解柱塞2判断", ""));
        mcgsXzzBo.setMcgsXz7(data.getStr("小闸缓解柱塞缩孔状态", ""));
        mcgsXzzBo.setMcgsXz8(data.getStr("小闸缓解柱塞凸轮状态", ""));
        mcgsXzzBo.setMcgsXz9(data.getStr("小闸均衡堵塞判断", ""));
        mcgsXzzBo.setMcgsXz10(data.getStr("小闸开关818状态", ""));
        mcgsXzzBo.setMcgsXz11(data.getStr("小闸空气位均衡充风时间", ""));
        mcgsXzzBo.setMcgsXz12(data.getStr("小闸排风阀口开度状态", ""));
        mcgsXzzBo.setMcgsXz13(data.getStr("小闸排风阀口状态", ""));
        mcgsXzzBo.setMcgsXz14(data.getStr("小闸全制动减压时间", ""));
        mcgsXzzBo.setMcgsXz15(data.getStr("小闸上闸慢", ""));
        mcgsXzzBo.setMcgsXz16(data.getStr("小闸上闸时间", ""));
        mcgsXzzBo.setMcgsXz17(data.getStr("小闸转换柱塞O型圈1状态", ""));
        mcgsXzzBo.setMcgsXz18(data.getStr("小闸转换柱塞O型圈2状态", ""));
        mcgsXzzBo.setMcgsXz19(data.getStr("小闸转换柱塞O型圈3状态", ""));
        mcgsXzzBo.setMcgsXz20(data.getStr("小闸指示D1状态", ""));
        mcgsXzzBo.setDelFlag("0");
        mcgsXzzBo.setCreateBy("admin");
        mcgsXzzBo.setUpdateBy("admin");
        return iMcgsXzzService.insertByBo(mcgsXzzBo);

    }

    private Boolean insertData00010(JSONObject data) {
        McgsXzz1Bo mcgsXzzBo = new McgsXzz1Bo();
        mcgsXzzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsXzzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsXzzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsXzzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsXzzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsXzzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsXzzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsXzzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsXzzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsXzzBo.setMcgsXz1(data.getStr("小闸818凸轮状态", ""));
        mcgsXzzBo.setMcgsXz2(data.getStr("小闸电空位缓解时间", ""));
        mcgsXzzBo.setMcgsXz3(data.getStr("小闸电空位开关状态", ""));
        mcgsXzzBo.setMcgsXz4(data.getStr("小闸调压阀管堵判断", ""));
        mcgsXzzBo.setMcgsXz5(data.getStr("小闸缓解柱塞1判断", ""));
        mcgsXzzBo.setMcgsXz6(data.getStr("小闸缓解柱塞2判断", ""));
        mcgsXzzBo.setMcgsXz7(data.getStr("小闸缓解柱塞缩孔状态", ""));
        mcgsXzzBo.setMcgsXz8(data.getStr("小闸缓解柱塞凸轮状态", ""));
        mcgsXzzBo.setMcgsXz9(data.getStr("小闸均衡堵塞判断", ""));
        mcgsXzzBo.setMcgsXz10(data.getStr("小闸开关818状态", ""));
        mcgsXzzBo.setMcgsXz11(data.getStr("小闸空气位均衡充风时间", ""));
        mcgsXzzBo.setMcgsXz12(data.getStr("小闸排风阀口开度状态", ""));
        mcgsXzzBo.setMcgsXz13(data.getStr("小闸排风阀口状态", ""));
        mcgsXzzBo.setMcgsXz14(data.getStr("小闸全制动减压时间", ""));
        mcgsXzzBo.setMcgsXz15(data.getStr("小闸上闸慢", ""));
        mcgsXzzBo.setMcgsXz16(data.getStr("小闸上闸时间", ""));
        mcgsXzzBo.setMcgsXz17(data.getStr("小闸转换柱塞O型圈1状态", ""));
        mcgsXzzBo.setMcgsXz18(data.getStr("小闸转换柱塞O型圈2状态", ""));
        mcgsXzzBo.setMcgsXz19(data.getStr("小闸转换柱塞O型圈3状态", ""));
        mcgsXzzBo.setMcgsXljc(data.getStr("泄漏检查窗口显示", ""));
        mcgsXzzBo.setDelFlag("0");
        mcgsXzzBo.setCreateBy("admin");
        mcgsXzzBo.setUpdateBy("admin");
        return iMcgsXzz1Service.insertByBo(mcgsXzzBo);

    }

    private Boolean insertData00011(JSONObject data) {
        McgsJjf1zBo mcgsJjf1zBo = new McgsJjf1zBo();
        mcgsJjf1zBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsJjf1zBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsJjf1zBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsJjf1zBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsJjf1zBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsJjf1zBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsJjf1zBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsJjf1zBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsJjf1zBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsJjf1zBo.setMcgsJjf1(data.getStr("紧急阀1号缩孔状态", ""));
        mcgsJjf1zBo.setMcgsJjf2(data.getStr("紧急阀3号缩孔状态", ""));
        mcgsJjf1zBo.setMcgsJjf3(data.getStr("紧急阀安定性", ""));
        mcgsJjf1zBo.setMcgsJjf4(data.getStr("紧急阀大O型圈状态", ""));
        mcgsJjf1zBo.setMcgsJjf5(data.getStr("紧急阀阀口状态", ""));
        mcgsJjf1zBo.setMcgsJjf6(data.getStr("紧急阀紧急制动时间", ""));
        mcgsJjf1zBo.setMcgsJjf7(data.getStr("紧急阀膜板灵敏度", ""));
        mcgsJjf1zBo.setMcgsJjf8(data.getStr("紧急阀微动开关状态", ""));
        mcgsJjf1zBo.setMcgsJjf9(data.getStr("紧急阀小O型圈状态", ""));
        mcgsJjf1zBo.setMcgsJjf10(data.getStr("紧急缸充风时间", ""));
        mcgsJjf1zBo.setDelFlag("0");
        mcgsJjf1zBo.setCreateBy("admin");
        mcgsJjf1zBo.setUpdateBy("admin");
        return iMcgsJjf1zService.insertByBo(mcgsJjf1zBo);
    }

    private Boolean insertData00012(JSONObject data) {
        McgsJjf2zBo mcgsJjf1zBo = new McgsJjf2zBo();
        mcgsJjf1zBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsJjf1zBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsJjf1zBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsJjf1zBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsJjf1zBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsJjf1zBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsJjf1zBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsJjf1zBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsJjf1zBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsJjf1zBo.setMcgsJjf1(data.getStr("紧急阀1号缩孔状态", ""));
        mcgsJjf1zBo.setMcgsJjf2(data.getStr("紧急阀3号缩孔状态", ""));
        mcgsJjf1zBo.setMcgsJjf3(data.getStr("紧急阀安定性", ""));
        mcgsJjf1zBo.setMcgsJjf4(data.getStr("紧急阀大O型圈状态", ""));
        mcgsJjf1zBo.setMcgsJjf5(data.getStr("紧急阀阀口状态", ""));
        mcgsJjf1zBo.setMcgsJjf6(data.getStr("紧急阀紧急制动时间", ""));
        mcgsJjf1zBo.setMcgsJjf7(data.getStr("紧急阀膜板灵敏度", ""));
        mcgsJjf1zBo.setMcgsJjf8(data.getStr("紧急阀微动开关状态", ""));
        mcgsJjf1zBo.setMcgsJjf9(data.getStr("紧急阀小O型圈状态", ""));
        mcgsJjf1zBo.setMcgsJjf10(data.getStr("紧急缸充风时间", ""));
        mcgsJjf1zBo.setDelFlag("0");
        mcgsJjf1zBo.setCreateBy("admin");
        mcgsJjf1zBo.setUpdateBy("admin");
        return iMcgsJjf2zService.insertByBo(mcgsJjf1zBo);
    }

    private Boolean insertData00013(JSONObject data) {
        McgsJjfzBo mcgsJjf1zBo = new McgsJjfzBo();
        mcgsJjf1zBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsJjf1zBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsJjf1zBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsJjf1zBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsJjf1zBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsJjf1zBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsJjf1zBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsJjf1zBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsJjf1zBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsJjf1zBo.setMcgsJjf1(data.getStr("紧急阀1号缩孔状态", ""));
        mcgsJjf1zBo.setMcgsJjf2(data.getStr("紧急阀3号缩孔状态", ""));
        mcgsJjf1zBo.setMcgsJjf3(data.getStr("紧急阀安定性", ""));
        mcgsJjf1zBo.setMcgsJjf4(data.getStr("紧急阀大O型圈状态", ""));
        mcgsJjf1zBo.setMcgsJjf5(data.getStr("紧急阀阀口状态", ""));
        mcgsJjf1zBo.setMcgsJjf6(data.getStr("紧急阀紧急制动时间", ""));
        mcgsJjf1zBo.setMcgsJjf7(data.getStr("紧急阀膜板灵敏度", ""));
        mcgsJjf1zBo.setMcgsJjf8(data.getStr("紧急阀微动开关状态", ""));
        mcgsJjf1zBo.setMcgsJjf9(data.getStr("紧急阀小O型圈状态", ""));
        mcgsJjf1zBo.setMcgsJjf10(data.getStr("紧急缸充风时间", ""));
        mcgsJjf1zBo.setDelFlag("0");
        mcgsJjf1zBo.setCreateBy("admin");
        mcgsJjf1zBo.setUpdateBy("admin");
        return iMcgsJjfzService.insertByBo(mcgsJjf1zBo);
    }

    private Boolean insertData00014(JSONObject data) {
        McgsZchzBo mcgsZchzBo = new McgsZchzBo();
        mcgsZchzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsZchzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsZchzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsZchzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsZchzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsZchzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsZchzBo.setDelFlag("0");
        mcgsZchzBo.setCreateBy("admin");
        mcgsZchzBo.setUpdateBy("admin");
        return iMcgsZchzService.insertByBo(mcgsZchzBo);
    }

    private Boolean insertData00015(JSONObject data) {
        McgsZdfzBo mcgsZdfzBo = new McgsZdfzBo();
        mcgsZdfzBo.setDjNo(data.getStr("车号", "C1001"));
        mcgsZdfzBo.setMcgsTime(data.getStr("MCGS_Time", ""));
        mcgsZdfzBo.setMcgsTimeMs(data.getStr("MCGS_TimeMS", ""));
        mcgsZdfzBo.setMcgsCzz(data.getStr("操作者", ""));
        mcgsZdfzBo.setMcgsJxbh(data.getStr("检修编号", ""));
        mcgsZdfzBo.setMcgsFh(data.getStr("阀号", ""));
        mcgsZdfzBo.setMcgsSch(data.getStr("删除号", ""));
        mcgsZdfzBo.setMcgsBy1(data.getStr("备用1", ""));
        mcgsZdfzBo.setMcgsZsch(data.getStr("装上车号", ""));
        mcgsZdfzBo.setMcgsZdf4(data.getStr("遮断阀供气阀口泄漏", ""));
        mcgsZdfzBo.setMcgsJxbhsr(data.getStr("检修编号输入", ""));
        mcgsZdfzBo.setMcgsZdf1(data.getStr("遮断阀大鞲鞴泄漏", ""));
        mcgsZdfzBo.setMcgsZdf2(data.getStr("遮断阀小鞲鞴泄漏", ""));
        mcgsZdfzBo.setMcgsZdf3(data.getStr("遮断阀供气阀开度", ""));
        mcgsZdfzBo.setDelFlag("0");
        mcgsZdfzBo.setCreateBy("admin");
        mcgsZdfzBo.setUpdateBy("admin");
        return iMcgsZdfzService.insertByBo(mcgsZdfzBo);
    }

    private Boolean insertDrDamper(JSONObject data) {
        DrDamperDataBo bo = new DrDamperDataBo();
        bo.setDjNo(data.getStr("车号", "C1001"));
        bo.setDrId(data.getLong("ID", 0L));
        bo.setDrDamperNo(data.getStr("DamperNo"));
        bo.setDrDamperType(data.getStr("DamperType"));
        bo.setDrCarNo(data.getStr("CarNo"));
        bo.setDrCarType(data.getStr("CarType"));
        bo.setDrProduceDate(data.getStr("ProduceDate"));
        bo.setDrLastTestDate(data.getStr("LastTestDate"));
        bo.setDrUsedLength(data.getStr("UsedLength"));
        bo.setDrUsedMonth(data.getStr("UsedMonth"));
        bo.setDrFV(data.getStr("F/V"));
        bo.setDrAmplititude(data.getStr("Amplititude"));
        bo.setDrFriquency(data.getStr("Friquency"));
        bo.setDrVelocityInterval(data.getStr("VelocityInterval"));
        bo.setDrTotalResult(data.getStr("TotalResult"));
        bo.setDrTestDate(data.getStr("TestDate"));
        bo.setDrOperator(data.getStr("Operator"));
        bo.setDrChecker(data.getStr("Checker"));
        bo.setDrTestSetNum(data.getStr("TestSetNum"));
        bo.setDrVelocitySet0(data.getStr("VelocitySet0"));
        bo.setDrFtset0(data.getStr("Ftset0"));
        bo.setDrFpset0(data.getStr("Fpset0"));
        bo.setDrErrPset0(data.getStr("ErrPset0"));
        bo.setDrErrNset0(data.getStr("ErrNset0"));
        bo.setDrDissymmetrySet0(data.getStr("DissymmetrySet0"));
        bo.setDrVelocitySet1(data.getStr("VelocitySet1"));
        bo.setDrFtset1(data.getStr("Ftset1"));
        bo.setDrFpset1(data.getStr("Fpset1"));
        bo.setDrErrPset1(data.getStr("ErrPset1"));
        bo.setDrErrNset1(data.getStr("ErrNset1"));
        bo.setDrDissymmetrySet1(data.getStr("DissymmetrySet1"));
        bo.setDrVelocitySet2(data.getStr("VelocitySet2"));
        bo.setDrFtset2(data.getStr("Ftset2"));
        bo.setDrFpset2(data.getStr("Fpset2"));
        bo.setDrErrPset2(data.getStr("ErrPset2"));
        bo.setDrErrNset2(data.getStr("ErrNset2"));
        bo.setDrDissymmetrySet2(data.getStr("DissymmetrySet2"));
        bo.setDrVelocitySet3(data.getStr("VelocitySet3"));

        bo.setDrFtset3(data.getStr("Ftset3"));
        bo.setDrFpset3(data.getStr("Fpset3"));
        bo.setDrErrPset3(data.getStr("ErrPset3"));
        bo.setDrErrNset3(data.getStr("ErrNset3"));
        bo.setDrDissymmetrySet3(data.getStr("DissymmetrySet3"));
        bo.setDrVelocitySet4(data.getStr("VelocitySet4"));
        bo.setDrFtset4(data.getStr("Ftset4"));
        bo.setDrFpset4(data.getStr("Fpset4"));
        bo.setDrErrPset4(data.getStr("ErrPset4"));
        bo.setDrErrNset4(data.getStr("ErrNset4"));
        bo.setDrDissymmetrySet4(data.getStr("DissymmetrySet4"));
        bo.setDrDt0(data.getStr("dt0"));
        bo.setDrDt1(data.getStr("dt1"));
        bo.setDrDt2(data.getStr("dt2"));
        bo.setDrDt3(data.getStr("dt3"));
        bo.setDrDt4(data.getStr("dt4"));
        bo.setDrDamperData00(data.getStr("damperData0_0"));
        bo.setDrDamperData10(data.getStr("damperData1_0"));
        bo.setDrDamperData20(data.getStr("damperData2_0"));
        bo.setDrDamperData30(data.getStr("damperData3_0"));
        bo.setDrDamperData40(data.getStr("damperData4_0"));
        bo.setDrDamperData01(data.getStr("damperData0_1"));
        bo.setDrDamperData11(data.getStr("damperData1_1"));
        bo.setDrDamperData21(data.getStr("damperData2_1"));
        bo.setDrDamperData31(data.getStr("damperData3_1"));
        bo.setDrDamperData41(data.getStr("damperData4_1"));
        bo.setDrTestAmplitude0(data.getStr("TestAmplitude0"));
        bo.setDrVelocityTension0(data.getStr("VelocityTension0"));
        bo.setDrFtesion0(data.getStr("Ftesion0"));
        bo.setDrErrFtension0(data.getStr("ErrFtension0"));
        bo.setDrResultTension0(data.getStr("ResultTension0"));
        bo.setDrVelocityPress0(data.getStr("VelocityPress0"));
        bo.setDrErrEpress0(data.getStr("ErrEpress0"));
        bo.setDrFpress(data.getStr("Fpress0"));
        bo.setDrResultPress0(data.getStr("ResultPress0"));
        bo.setDrResultDissymmetry0(data.getStr("ResultDissymmetry0"));
        bo.setDrFV0(data.getStr("f/v0"));
        bo.setDrTestResult0(data.getStr("TestResult0"));
        bo.setDrTestAmplitude1(data.getStr("TestAmplitude1"));
        bo.setDrVelocityTension1(data.getStr("VelocityTension1"));
        bo.setDrFtension1(data.getStr("Ftension1"));
        bo.setDrErrFtension1(data.getStr("ErrFtension1"));
        bo.setDrResultTension1(data.getStr("ResultTension1"));
        bo.setDrVelocitypress1(data.getStr("Velocitypress1"));
        bo.setDrErrFpress1(data.getStr("ErrFpress1"));
        bo.setDrFpress1(data.getStr("Fpress1"));
        bo.setDrResultPress1(data.getStr("ResultPress1"));
        bo.setDrResultDissymmetry1(data.getStr("ResultDissymmetry1"));
        bo.setDrFV1(data.getStr("f/v1"));
        bo.setDrTestResult1(data.getStr("TestResult1"));
        bo.setDrTestAmplitude2(data.getStr("TestAmplitude2"));
        bo.setDrVelocityTension2(data.getStr("VelocityTension2"));
        bo.setDrFtension2(data.getStr("Ftension2"));
        bo.setDrErrFtension2(data.getStr("ErrFtension2"));
        bo.setDrResultTension2(data.getStr("ResultTension2"));
        bo.setDrVelocityPress2(data.getStr("VelocityPress2"));
        bo.setDrErrFpress2(data.getStr("ErrFpress2"));
        bo.setDrFpress2(data.getStr("Fpress2"));
        bo.setDrResultPress2(data.getStr("ResultPress2"));
        bo.setDrResultDissymmetry2(data.getStr("ResultDissymmetry2"));
        bo.setDrFV2(data.getStr("f/v2"));
        bo.setDrTestResult2(data.getStr("TestResult2"));
        bo.setDrTestAmplitude3(data.getStr("TestAmplitude3"));
        bo.setDrVelocityTension3(data.getStr("VelocityTension3"));
        bo.setDrFtension3(data.getStr("Ftension3"));
        bo.setDrErrFtension3(data.getStr("ErrFtension3"));
        bo.setDrResultTension3(data.getStr("ResultTension3"));
        bo.setDrVelocityPress3(data.getStr("VelocityPress3"));
        bo.setDrErrFpress3(data.getStr("ErrFpress3"));
        bo.setDrFpress3(data.getStr("Fpress3"));
        bo.setDrResultPress3(data.getStr("ResultPress3"));
        bo.setDrResultDissymmetry3(data.getStr("ResultDissymmetry3"));
        bo.setDrFV3(data.getStr("f/v3"));
        bo.setDrTestResult3(data.getStr("TestResult3"));
        bo.setDrTestAmplitude4(data.getStr("TestAmplitude4"));
        bo.setDrVelocityTension4(data.getStr("VelocityTension4"));
        bo.setDrFtension4(data.getStr("Ftension4"));
        bo.setDrErrFtension4(data.getStr("ErrFtension4"));
        bo.setDrResultTension4(data.getStr("ResultTension4"));
        bo.setDrVelocityPress4(data.getStr("VelocityPress4"));
        bo.setDrErrFpress4(data.getStr("ErrFpress4"));
        bo.setDrFpress4(data.getStr("Fpress4"));
        bo.setDrResultPress4(data.getStr("ResultPress4"));
        bo.setDrResultDissymmetry4(data.getStr("ResultDissymmetry4"));
        bo.setDrFV4(data.getStr("f/v4"));
        bo.setDrTestResult4(data.getStr("TestResult4"));
        bo.setDrRemark(data.getStr("Remark"));
        bo.setDelFlag("0");
        bo.setCreateBy("admin");
        bo.setUpdateBy("admin");
        return iDrDamperDataService.insertByBo(bo);

    }
}
